package com.pason.onlineshop.mainshop.service.task.impl;

import java.lang.reflect.Field;

import com.pason.onlineshop.mainshop.annotation.QueryField;

public class QueryUtil {
	public static QueryFieldResult getQueryFieldByWebName(Class clazz, String webName) {

		for(Field field : clazz.getDeclaredFields()) {
			QueryField qf = field.getAnnotation(QueryField.class);
			if(null != qf && webName.equals(qf.webName())) {
				QueryFieldResult result = new QueryFieldResult();
				result.setFieldDBName(field.getName());
				result.setQueryOperateType(qf.queryType());
				return result;
			}
		}

		return null;

	}
}
